CCM-17221: Add priority field to LetterVariant schema#58
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a priority field to the LetterVariant schema so letter variants can be ordered for supplier dispatch/queueing using a 1–100 integer scale (lower number = higher priority), with a default applied when omitted.
Changes:
- Extend
LetterVariantZod schema withpriority: int(1..100)defaulting to50. - Update examples and unit tests across packages to include/validate
priority(range checks, integer enforcement, defaulting). - Bump
@nhsdigital/nhs-notify-event-schemas-supplier-configpackage version to1.1.0.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/events/src/domain/letter-variant.ts | Adds priority field (validated + defaulted) to the core LetterVariant schema. |
| packages/events/src/events/tests/letter-variant-events.test.ts | Extends event fixtures and adds validation tests for priority (int/range/default). |
| packages/events/src/examples/specification-examples.ts | Updates example LetterVariant objects to include priority values. |
| packages/file-store/src/tests/config-store-validator.test.ts | Updates mocked schema and adds validator coverage for out-of-range priority. |
| packages/event-builder/src/tests/letter-variant-event-builder.test.ts | Updates builder test input to include priority in LetterVariant partial. |
| packages/events/package.json | Version bump to reflect the schema change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
stevebux
approved these changes
Apr 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The supplier configuration schema currently has no concept of priority across letter variants. As NHS Notify scales to support more suppliers and higher message volumes, the ability to prioritise certain letter variants (e.g. urgent clinical communications) over others is necessary to meet SLA and contractual requirements.
This ticket introduces a priority field to the LetterVariant config schema. The field uses a 1–100 integer scale where lower values represent higher priority (i.e. 1 is the highest priority). This value will be used by the letter processing system to order pending letters in the queue and allow higher-priority letters to be promoted ahead of lower-priority ones.
Context
Type of changes
Checklist
Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.